package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016101100661005";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCGJpTHvTg3OjB6FszUfQ8ny5yuUsw0pV8f2RUwuBj1G9EWsbPL3jdyeHDvWTwOPrsAQVyPFauxqsZgpK1E/A/ZY4sP1Gt81GFyw23hL721p/3OMUVqtDYs+QeR7X0O4ZqfVzL96Epl9rt218bdBIvHjWWQcP/VEEhaz/5ypwnayajse6605/lpZTgZaoblQ/A7K82O2nwVfDjgVcg2vYLN37xvK5vOuLfIpRIZ+kxGwAOJiJ1Qyl+wb+qRs1IDDqrNyqYsYOTHGUtDefw0TEIA/acOnYxIN0imX+i++E2bRJ5ubDQymaLXDbpWrdA2pZgXCpPo7IrU2WlW+cUzRsflAgMBAAECggEAEBMdbtW4n72EQ4zp3Ghj4YPfcXAQchqCzIEprd3Rd8Vuh4ahocMt57SQ681IifhwVfZ/DdIt8ash/ECfVo3RpF3uMuZkPuAAEU1jpEEhPVw06Hk09TVE7JymkJDhlF/qND+xp4UnLRKkoff3J1K9IRtLWUSBE1nRIbicp8ZmQuYMtQIlr8TJmF52IAYN0K1QyNIigAWaQlswY4izC9YS2he4tlQZ+n+Z/wmgduKUK6OWwfEuCW/5AiEPS6xJcUVt2vRrJzgVEjbBHp12xCdurlMrnd5nODGVpkUNWwmN1PKdg9SYMvero7wKnKBBSxbTuI24mi3YfZkOKhsgVkYvnQKBgQDC2Ff8IFi1By7XzHZpIxU0+iPOQpX5K0RxbruwRCtiRj5Iud4Lx9jnR31LIHsFh33n1L1u2PyFYCpOm73viRYSjB7Af+8q5VMowRx1pUtvyGLC6rEUu0dCDWazN2dsl8Fu2blYsiJfwVIT7HfXSaRENO0iBazL4nek2IjeRE4IqwKBgQCwQX1KIsYN330RO3Er2Z3xuPcyxELfTUWLTsAu0IiV8i2Z+lI22Vje/YASU6okacqetE6GCpjdaDrezCXKWe4xCRpv1wsgqC1db6rF2IHrKtIM8/hMLKWCcihkXxS2rxECUaORScTcSXpgJGuyupprNjS/glmj6GOJIDhtGRKRrwKBgD9r1BfJH5atI94yO0i1lq2LziPRIKfeIYUamhUh2009uABMH66N+lgtuOa/R8vg8maHpLF0B54SUzMLFqPlZz3aRhg6jErWIl9dnDne99MG0r7HTaSF4Qfq/MbQ/eUm8Ft4mw/3y6CHeIPrsIZu/f0FjTpJxpkGuhL6OHLAoPXJAoGAJIcN/iVCwnFErCOTirDo6MWahWzjJwAOn5ZMgec5x0mPZc/Y5gEZR+1lc2bfZfh+w3E+rMzZbVlCihXo5wzILmVikzcP2U7BSBHyZFpAYopXSdPt62t9SZF7CYIi+tFBRyfALEYLhFO+BtrFbx75DasIN4A+L5fjuPFygDmn/YUCgYAm+mWeBPSLE/QKQilIRRR/zOGSKTebZ5phGmLZlAIKB2btH+DWFhJJCVt9/vAg149X/iQJyglb/2WdO81RUMtsGqtbRduRNexZGjvbcNfY0zFu2WuyfriAr2l3kGiz9fIAMd91GVp9WIK6NVydtF0JnlvhajDvkIp4ygvhbiGpsw==";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhiaUx704NzowehbM1H0PJ8ucrlLMNKVfH9kVMLgY9RvRFrGzy943cnhw71k8Dj67AEFcjxWrsarGYKStRPwP2WOLD9RrfNRhcsNt4S+9taf9zjFFarQ2LPkHke19DuGan1cy/ehKZfa7dtfG3QSLx41lkHD/1RBIWs/+cqcJ2smo7HuutOf5aWU4GWqG5UPwOyvNjtp8FXw44FXINr2Czd+8byubzri3yKUSGfpMRsADiYidUMpfsG/qkbNSAw6qzcqmLGDkxxlLQ3n8NExCAP2nDp2MSDdIpl/ovvhNm0Sebmw0Mpmi1w26Vq3QNqWYFwqT6OyK1NlpVvnFM0bH5QIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://192.168.2.2:8888/pay/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://192.168.2.2:8888/pay/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

